package com.hitqz.robot.biz.schedule;

import com.hitqz.robot.api.common.entity.BatteryDataInfo;
import com.hitqz.robot.biz.service.BatteryDataInfoService;
import com.hitqz.robot.driver.model.IRobotPosDto;
import com.hitqz.robot.driver.parent.RobotDriverService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author xupkun
 * @date 2024/11/15
 */
@Component
@RequiredArgsConstructor
@Slf4j
public class StatisticalSchedule {

    private final RobotDriverService robotDriverService;

    private final BatteryDataInfoService batteryDataInfoService;

    /**
     * 电池数据统计
     */
    @Scheduled(cron = "0/10 * * * * ?")
    public void staticBattery() {
//        IRobotPosDto iRobotPosDto = robotDriverService.getWebPos();
//        if (iRobotPosDto != null) {
//            BatteryDataInfo info = new BatteryDataInfo();
//            info.setBattery(String.valueOf(iRobotPosDto.getBatteryLevel()));
//            info.setVoltage(String.valueOf(iRobotPosDto.getVoltage()));
//            info.setCurrent(String.valueOf(iRobotPosDto.getCurrent()));
//            batteryDataInfoService.save(info);
//        }
    }

}
